﻿using System.ComponentModel.DataAnnotations;
using YNTK.Common.Enum;
using YNTK.Common.Filter;
using YNTK.Dependency;

namespace YNTK.VisitorsRecord.Entitys
{
    /// <summary>
    /// 查询外来资料请求模型
    /// </summary>
    [SuppressSniffer]
    public class QueryForeignDataFilterRequestModel: PageBaseRequestModel
    {
        /// <summary>
        /// 机构id
        /// </summary>
        public string? mechanismId { get; set; } = string.Empty;

        /// <summary>
        /// 外来资料分类id
        /// </summary>
        public string? classifyId { get; set; } = string.Empty;

        /// <summary>
        /// 共享范围(null.全部 0.全组织 1.特定机构 2.特定角色 3.特定用户 4.仅自己可见)
        /// </summary>
        public SharedScopeEnum? sharedScope { get; set; } = null;

        /// <summary>
        /// 创建时间-起
        /// </summary>
        public DateTime? startTime { get; set; } = null;

        /// <summary>
        /// 创建时间-止
        /// </summary>
        public DateTime? endTime { get; set; } = null;

        /// <summary>
        /// 启用/禁用,1.启用 0.禁用 2.全部
        /// </summary>
        public int? enabledMark { get; set; } = null;

        /// <summary>
        /// 模糊查询,标题
        /// </summary>
        /// <example></example>
        public string? keyword { get; set; } = string.Empty;
    }

    /// <summary>
    /// 外来资料数据传输模型
    /// </summary>
    [SuppressSniffer]
    public class ForeignDataListDto
    {
        /// <summary>
        /// id
        /// </summary>
        public string id { get; set; }

        /// <summary>
        /// 所属机构id
        /// </summary>
        public string mechanismId { get; set; }

        /// <summary>
        /// 所属机构名称
        /// </summary>
        public string mechanismName { get; set; }

        /// <summary>
        /// 外来资料分类id
        /// </summary>
        public string classifyId { get; set; }

        /// <summary>
        /// 外来资料分类名称
        /// </summary>
        public string classifyName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? creatorTime { get; set; }

        /// <summary>
        /// 创建用户
        /// </summary>
        public string creatorUserId { get; set; }

        /// <summary>
        /// 创建用户姓名
        /// </summary>
        public string creatorUserName { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? lastModifyTime { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string title { get; set; }

        /// <summary>
        /// 浏览次数
        /// </summary>
        public int viewCount { get; set; }

        /// <summary>
        /// 共享范围(0.全组织 1.特定机构 2.特定角色 3.特定用户 4.仅自己可见)
        /// </summary>
        public int sharedScope { get; set; }

        /// <summary>
        /// 共享范围文本
        /// </summary>
        public string sharedScopeText { get; set; }

        /// <summary>
        /// 排序码
        /// </summary>
        public long? sortCode { get; set; }

        /// <summary>
        /// 启用/禁用,1.启用
        /// </summary>
        public int? enabledMark { get; set; }
    }

    /// <summary>
    /// 外来资料信息传输模型
    /// </summary>
    [SuppressSniffer]
    public class ForeignDataInfoDto: ForeignDataListDto
    {
        /// <summary>
        /// 共享范围为角色或用户时使用
        /// </summary>
        public string sharedScopeValue { get; set; }

        /// <summary>
        /// 共享范围为机构时使用
        /// </summary>
        public List<string[]> sharedScopeMechanismValue { get; set; }

        /// <summary>
        /// 共享范围显示文本
        /// </summary>
        public string sharedScopeValueText { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public string content { get; set; }

        /// <summary>
        /// 外来资料相关附件数据
        /// </summary>
        public List<CommonFileListDto> fileData { get; set; }
    }

    /// <summary>
    /// 添加外来资料请求模型
    /// </summary>
    [SuppressSniffer]
    public class AddForeignDataRequestModel
    {
        /// <summary>
        /// 外来资料分类id
        /// </summary>
        [Required(ErrorMessage = "外来资料分类标识不能为空")]
        public string classifyId { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [Required(ErrorMessage = "标题不能为空")]
        public string title { get; set; }

        /// <summary>
        /// 共享范围(0.全组织 1.特定机构 2.特定角色 3.特定用户 4.仅自己可见)
        /// </summary>
        [Required(ErrorMessage = "请选择共享范围")]
        public SharedScopeEnum sharedScope { get; set; }

        /// <summary>
        /// 共享范围,多个机构/角色/用户按逗号分割,SharedScope为0或4时为空
        /// </summary>
        public string sharedScopeValue { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public string content { get; set; }

        /// <summary>
        /// 排序码
        /// </summary>
        public long? sortCode { get; set; }

        /// <summary>
        /// 启用/禁用,1.启用
        /// </summary>
        public int? enabledMark { get; set; }

        /// <summary>
        /// 浏览次数
        /// </summary>
        public int viewCount { get; set; }

        /// <summary>
        /// 相关附件数据
        /// </summary>
        public List<CommonFileRequestModel> fileData { get; set; }
    }

    /// <summary>
    /// 修改外来资料请求模型
    /// </summary>
    [SuppressSniffer]
    public class UpdateForeignDataRequestModel: AddForeignDataRequestModel
    {
        /// <summary>
        /// 外来资料id
        /// </summary>
        [Required(ErrorMessage = "外来资料唯一标识不能为空")]
        public string id { get; set; }
    }

}
